package com.resou.reader.data.tinder.remote;


import com.resou.reader.api.entry.Result;
import com.resou.reader.api.entry.ResultList;
import com.resou.reader.data.Injection;
import com.resou.reader.data.tinder.TinderDataSource;
import com.resou.reader.data.tinder.tinder.CartBook;
import com.resou.reader.data.tinder.tinder.SlideBean;

import io.reactivex.Observable;
import retrofit2.Retrofit;

public class TinderRemoteDataSource implements TinderDataSource {
    public static TinderRemoteDataSource sInstance;
    private final TinderService mService;
    private static final String TAG = "RemoteDataSource-App";

    private TinderRemoteDataSource() {
        Retrofit retrofit = Injection.provideReleaseRetrofit();
        mService = retrofit.create(TinderService.class);
    }

    public TinderService getService() {
        return mService;
    }

    public static TinderRemoteDataSource getInstance() {
        if (sInstance == null) {
            sInstance = new TinderRemoteDataSource();
        }
        return sInstance;
    }

    @Override
    public Observable<ResultList<SlideBean>> getSlideList(int page, String token, String deviceType) {
        return mService.getSlideList(page, token, deviceType);
    }

    @Override
    public Observable<Result<String>> delete(String token, String bookIdStr) {
        return mService.delete(token, bookIdStr);
    }

    @Override
    public Observable<Result> addToShoppingCart(String bookId, String token) {
        return mService.addToShoppingCart(bookId, token);
    }

    @Override
    public Observable<Result<String>> getCartCount(String token) {
        return mService.getCartCount(token);
    }

    @Override
    public int getLocalCartCount() {
        return 0;
    }

    @Override
    public Observable<ResultList<CartBook>> getCartBookListAll(String token) {
        return mService.getCartBookListAll(token);
    }

    @Override
    public Observable<ResultList<CartBook>> getCartBookListByPage(String token) {
        return null;
    }

}
